Español English

Introduction to SVG

SVG (Scalable Vector Graphics) is an XML-based image format for describing vector graphics for the web. Unlike raster images (such as PNG or JPEG), SVG graphics are scalable, meaning they can be resized without losing quality.

Basic SVG Example

Here is a basic SVG code example:


<svg width="500" height="300">
    <rect x="10" y="10" width="150" height="100" style="fill:rgb(0,0,255);stroke-width:2;stroke:rgb(0,0,0)" />
    <circle cx="300" cy="150" r="50" stroke="black" stroke-width="3" fill="red" />
    <line x1="250" y1="70" x2="400" y2="70" style="stroke:rgb(233,115,4);stroke-width:2" />
    <text x="250" y="50" font-family="Verdana" font-size="35" fill="blue">Hello Web4U</text>
    <path d="M150 150 L75 250 L225 250 Z" stroke="green" stroke-width="3" fill="yellow" />
</svg>

            

Code Explanation:

This is a basic SVG code with various tags to draw geometric shapes and text:

Result in Browser

When this code is displayed in a browser, the result will look like this:

SVG Example

Useful Links

For more details about SVG features, visit the W3C Official Page.

You may also find the W3Schools SVG Tutorial helpful.